import java.io.FileOutputStream;
import java.security.cert.X509Certificate;

public class GenerateCa {

    private static String certPath="D:/test.cer";

    public static  void main(String[] args)
    {
        BaseCert baseCert=new BaseCert();
        X509Certificate cert=baseCert.generateCert("test");
        System.out.print(cert.toString());
        // 导出为cer证书
        try {
            FileOutputStream fos = new FileOutputStream(certPath);
            fos.write(cert.getEncoded());
            fos.close();
        }
        catch (Exception e)
        {
            e.printStackTrace();
        }
    }
}
